package com.sun.jdk.funref;

import java.util.function.Consumer;

public class FunctionRefTest02 {
    
    static int[] arr = {10,20,30,40,50,60};

    public static void main(String[] args) {
        getSum(FunctionRefTest02::getTotal);
    }

    private static void getTotal(int[] ints) {
        int sum = 0;
        for (int i : ints) {
            sum += i;
        }
        System.out.println("数组之和：" + sum);
    }

    public static void getSum(Consumer<int[]> consumer){
        consumer.accept(arr);
    }
}
